package com.example.xm.service.impl;

import com.example.xm.entity.Huiyuanentity;
import com.example.xm.entity.Typeentity;
import com.example.xm.entity.dto.TypeDto;
import com.example.xm.mapper.HuiyuanMapper;
import com.example.xm.service.HuiyuanService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author tong
* @description 针对表【huiyuan】的数据库操作Service实现
* @createDate 2024-04-13 12:37:40
*/
@Service
public class HuiyuanServiceImpl implements HuiyuanService {
@Autowired
HuiyuanMapper huiyuanMapper;
    @Override
    public void reg(Huiyuanentity typeentity) {
        huiyuanMapper.insert(typeentity);
    }

    @Override
    public void update(Huiyuanentity typeentity) {
        huiyuanMapper.updateByPrimaryKeySelective(typeentity);
    }

    @Override
    public PageInfo<Huiyuanentity> list(TypeDto dto) {
        PageHelper.startPage(dto.getPage(),dto.getSize());
        List<Huiyuanentity> list= huiyuanMapper.selectList(dto);
        PageInfo<Huiyuanentity> userentityPageInfo = new PageInfo<Huiyuanentity>(list);
        return userentityPageInfo;
    }

    @Override
    public void delete(int[] intArray) {
        huiyuanMapper.delete(intArray);
    }

    @Override
    public Huiyuanentity getById(Integer huiyuanId) {
        return huiyuanMapper.getById(huiyuanId);
    }
}




